package com.decent.common.oss.config;

import lombok.Getter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.stereotype.Component;

/**
 * 阿里巴巴oss对象存储配置信息
 *
 * @author wangyx
 */
@Configuration
@PropertySource(value = "classpath:oss-config.properties")
@Getter
//@Component(value = "OssConfig")
public class ManagerOssConfig extends AbstractOssConfig {
    /**
     * 阿里云账号id
     */
    @Value("${access_key_id}")
    private String accessKeyId;
    /**
     * 阿里云账号密钥
     */
    @Value("${access_key_secret}")
    private String accessKeySecret;
    /**
     * 对象存储oss外网endpoint
     */
    @Value("${end_point}")
    private String endPoint;
    /**
     * 存储空间
     */
    @Value("${bucket_name}")
    private String bucketName;
    /**
     * 存储根目录
     */
    @Value("${base_path}")
    private String basePath;

    /**
     * 对象存储oss公共endpoint
     */
    @Value("${public_end_point}")
    private String publicEndPoint;
    /**
     * 对象存储oss内网endpoint
     */
    @Value("${inner_end_point}")
    private String innerEndPoint;

    @Override
    public void init() {
        super.setAccessKeyId(accessKeyId);
        super.setAccessKeySecret(accessKeySecret);
        super.setBucketName(bucketName);
        super.setBasePath(basePath);
        super.setEndPoint(endPoint);
        super.setInnerEndPoint(innerEndPoint);
        super.setPublicEndPoint(publicEndPoint);
    }
}
